<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>修改名称 - {:config('web.WEB_TIT')}</title>
	{include file="member/public"}
</head>
<body>
	<header data-am-widget="header" class="am-header am-header-default jz">
	  <div class="am-header-left am-header-nav">
		 <a href="javascript:history.back()" class="">
			<i class="am-icon-chevron-left"></i>
		</a>
	  </div>
	  <h1 class="am-header-title">
		  <a href="#title-link" class="">{$member.username}</a>
	  </h1>
	</header>
	<ul class="nav mad" style="margin-top: 10px;">
		<input type="text" name="username" id="username" value="{$member.username}" placeholder="请输入昵称"/>
		<input type="hidden" name="__token__" id="token" value="{$Request.token}" />
	</ul>
	<div class="shure" id="submit">
		<a>确认修改</a>
	</div>
	<script type="text/javascript">
		$('#submit').click(function(){
			var username = $('#username').val();
			if(username == ''){
				alert('昵称不能为空');
				return false;
			}
			if(username.length > 12){
				alert('昵称必须小于12位');
				return false;
			}
			$.ajax({
				type: 'POST',
				url: "{:url('member/set_name')}",
				data:{username:username,token:$('#token').val()},
				dataType:'json',
				success: function(data){
                    if(data.code == 200){
                        alert(data.msg)
                        window.location.href = "{:url('member/set')}";
                    }else{
                        alert(data.msg)
                        location.reload(true);
                    }
				},
			});
		});
	</script>
</body>
</html>
